<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1,maximum-scale=1.0, user-scalable=0"/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="cache-control" content="no-cache"/>
    <meta http-equiv="expires" content="0"/>
    <title>登录</title>
    <link th:href="@{/style/loading.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/style/load_style.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/style/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/style/basic.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/style/index.css}" rel="stylesheet" type="text/css"/>
    <script src="http://static.runoob.com/assets/vue/1.0.11/vue.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"/>
</head>

<body class="b-fff">

<div class="container-fluid">
    <div class="row">

        <div class="content cf">
            <div class="logo"></div>
            <div class="p_20 loginBar" id="loginInfo">
                <p class="m_b_30">
                    <input style="width:100%;" type="text"  class="form-control input-login" placeholder="请输入用户名"
                           v-model="username"/>
                </p>
                <p class="yzmBar">
                    <input style="width:100%;" type="password" class="form-control input-login" placeholder="请输入密码"
                           id="inputPassword3" v-model="passWord"/>

                </p>
            </div>
            <div class="p_20 m_t_20 cf tc" id="submit">
                <input class="btn btn_red02 m_b_15" style="width:100%;" type="submit" name="button" id="button"
                       value="登录" v-on:click="fakeAjax"/>
            </div>
        </div>
        <!-- end 主要内容 -->
    </div>
</div>
<div th:replace="loading::loadtemp"></div>
<!--JavaScript插件都是依赖与jQuery库-->
<script th:src="@{/script/jquery.min.js}"></script>
<script th:src="@{/script/bootstrap.min.js}"></script>
<script th:src="@{/script/layer/layer.js}"></script>
<script th:src="@{/script/verifVersion.js}"></script>
</body>
<script>
    new Vue({
        el: '#submit',
        methods: {
            fakeAjax: function (event) {
                var strTel = loginInfo.username;
                if (strTel == null || strTel.length == 0) {
                    layer.msg("用户名不能为空");
                    return;
                }
                var strCode = loginInfo.passWord;
                if (strCode == null || strCode.length == 0) {
                    layer.msg('密码不能为空');
                     return;
                }
                load.loading = true;
                var obj = new Object();
                obj.userName = strTel;
                obj.pwd = strCode;
                $.ajax({
                    type: "POST",
                    url: "/server/loginByPwd",
                    data: obj,
                    beforeSend: function () {

                    },
                    success: function (data) {
                        load.loading = false;
                        if (data.errcode == "00000") {
                            layer.msg("登陆成功")
                            location.href = "/mrch/merchant_index";
                        }
                        else
                            layer.msg(data.errmsg);
                    },
                    error: function () {
                        layer.msg("登录异常，请重试");
                        load.loading = false;
                    }
                });
            }
        }
    });
    var loginInfo = new Vue({
        el: "#loginInfo",
        data: {
            username: null,
            passWord: null,
        }
    });
</script>

</html>